export default{
	state:{
		show:'false',
		user:{
		    uid: null,
		    //u:'79bf14de724b9a8553dd1b688f51306cd6dce06ed581e8f8a344a4269e899560f7e4d4ad04f0a58f6b36871d2b00966f9f62954beb439e58b3cfae1cc53ca90abfafb80ed4e1c6a2074dfbdf630cf90d',
		    u: null,
        loginName: null,
		    userName: null,
		    logo:null,
        phone:null,	
        longAlt:null,
        exp:null,//过期时间
        time:null,//存入时间
        points:null,//积分
        money:null//余额
	    }
	},
	mutations: {
    changeUser (state,User) {
      // 变更状态
      if(User.money != null){
         state.user.money = User.money
      }
      if(User.points != null){
        state.user.points = User.points
      }
    },
    loginUser (state,User) {
      // 登录状态
      if(User != null){
         state.user.money = User.money;
         state.user.points = User.points;
         state.user.uid = User.uid;
         state.user.u = User.u;
         state.user.loginName = User.loginName;
         state.user.userName = User.userName;
         state.user.exp = 10000;
         state.user.time = new Date().getTime()
      }
    },
    logout (state) {
      //退出
      state.user.uid = null,
      state.user.u = '',
      state.user.loginName = '',
      state.user.userName = '',
      state.user.points = '',
      state.user.money = ''
    }
  },
  actions: {
    changeUser (context) {
      context.commit('changeUser')
    },
    loginUser (context) {
      context.commit('loginUser')
    },
    logout (context) {
      context.commit('logout')
    }
  }
}